import Vue from "vue";
import ElementUI from "element-ui";
import 'amfe-flexible'
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "element-ui/lib/theme-chalk/index.css";
import "@/assets/styles/index.scss";
import "@/styles/index.css";
import "@/styles/animate.scss";
import './icons'
import ConBox from "@/components/ConBox.vue";


ElementUI.Dialog.props.closeOnClickModal.default = false;

Vue.use(ElementUI);
Vue.use(ElementUI);
Vue.config.productionTip = false;
Vue.component("ConBox", ConBox)

// 创建事件总线   就相当于创建了一个新的vue实例
const bus = new Vue()
// 把bus挂载到了Vue的原型上, 保证所有的组件都能通过 this.$bus访问到事件总线
Vue.prototype.$bus = bus


Vue.filter("toNumber", function (num, isTenThousand) {
  if (!num) return "0";
  if (isNaN(Number(num))) {
    // 如果不是个数字, 去掉,
    num = num.replaceAll(",", "");
  }
  if (isTenThousand) {
    num = +num / 10000;
  }
  if (+num > 9999.999999) return Math.floor(+num).toLocaleString();
  num = Math.floor(+num * 100) / 100;
  num = (+num).toLocaleString();
  let dotIndex = num.indexOf(".");
  if (dotIndex === -1) num = num + "";
  if (dotIndex === num.length - 3) num;
  if (dotIndex === num.length - 2) num = num + "";
  return num;
});

new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount("#app");
